package com.ktjy.crm.config;

import com.ktjy.crm.filter.AuthenticationInterceptor;
import jakarta.annotation.Resource;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

//定义为配置类
@Configuration
public class WebConfig implements WebMvcConfigurer {
    @Resource
    AuthenticationInterceptor authenticationInterceptor;


    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(authenticationInterceptor)
                .addPathPatterns("/**")                   // 拦截所有路径
                .excludePathPatterns("/login", "/doLogin");    // 排除登录接口
    }
}